﻿using System.Net;
using System.Threading;
using System.Windows;
using Microsoft.Phone.Controls;

namespace AuchanScan.Views
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            OrientationChanged += MainPage_OrientationChanged;

            this.Loaded += new RoutedEventHandler(MainPage_Loaded);

        }

        private bool first=true;
        void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            if(first)
            {
                first = false;
                ViewModels.ViewModelLocator.MainViewModelStatic.StartTestUsb();
            }
        }

   


        private void MainPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
        {
            if ((e.Orientation & PageOrientation.Landscape) != 0)
            {
                Herbe.Margin = new Thickness(0, 0, 0, -36);
                Pano.TitleTemplate = null;
                Pano.Margin = new Thickness(0, -12, 0, 0);
            }
            else
            {
                Herbe.Margin = new Thickness(0, 0, 0, 8);
                object v = Resources["HeaderDataTemplate"];
                Pano.TitleTemplate = v as DataTemplate;
                Pano.Margin = new Thickness(0);
            }
        }

        private void Historique_Click(object sender, System.Windows.RoutedEventArgs e)
        {
        }


    }
}
